﻿// <copyright file="MapInfoRegionTest.cs" company="QUT">
//     Copyright (c) Ninety Nine Percent. All rights reserved.
// </copyright>

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Qut.GenerateKml.Data
{
    /// <summary>
    /// a class for testing MapInfoRegion class.
    /// </summary>
    [TestFixture]

    public class MapInfoRegionTest
    {
        /// <summary>
        /// Test MapInfo Region
        /// </summary>
        private MapInfoRegion mir;

        /// <summary>
        /// Test MapInfo Polygon 1
        /// </summary>
        private MapInfoPolygon mip1;

        /// <summary>
        /// Test MapInfo Polygon 2
        /// </summary>
        private MapInfoPolygon mip2;

        /// <summary>
        /// Test MapInfo Polygon 3
        /// </summary>
        private MapInfoPolygon mip3;

        /// <summary>
        /// Initializes the all data member in the test.
        /// </summary>
        [SetUp]
        public void Initialize()
        {
            this.mir = new MapInfoRegion();
            this.mip1 = new MapInfoPolygon();
            this.mip2 = new MapInfoPolygon();
            this.mip3 = new MapInfoPolygon();
        }

        /// <summary>
        /// test the getNumPolygons function of MapInfoRegion class
        /// </summary>
        [Test]
        public void GetNumPolygonsTest1()
        {
            Assert.AreEqual(this.mir.GetNumPolygons(), 0);
        }

        /// <summary>
        /// test the getNumPolygons function of MapInfoRegion class
        /// </summary>
        [Test]
        public void GetNumPolygonsTest2()
        {
            this.mir.AddPolygon(this.mip1);
            Assert.AreEqual(this.mir.GetNumPolygons(), 1);
        }

        /// <summary>
        /// test the addPolygon &amp; getPolygons functions of MapInfoRegion class
        /// </summary>
        [Test]
        public void AddPolygonTest1()
        {
            this.mir.AddPolygon(this.mip1);
            Assert.AreEqual(this.mir.GetPolygons()[0], this.mip1);
        }

        /// <summary>
        /// test the addPolygon &amp; getPolygons functions of MapInfoRegion class
        /// </summary>
        [Test]
        public void AddPolygonTest2()
        {
            this.mir.AddPolygon(this.mip2);
            this.mir.AddPolygon(this.mip3);
            Assert.AreEqual(this.mir.GetPolygons()[0], this.mip2);
            Assert.AreEqual(this.mir.GetPolygons()[1], this.mip3);
        }
    }
}
